//
//  YNMessageContactManager.h
//  Messenger
//
//  Created by iOS on 15/4/21.
//  Copyright (c) 2015年 YN-APP-iOS. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YNIMFrameworkTypedef.h"
@class YNMessage;
@class YNBroadcastChat;
@class YNBroadcastNotificationChat;
@interface YNMessageContactManager : NSObject

#pragma mark - 更新会话消息

/**
 * 收到回执，更新数据库里面的消息
 * isChange是选择最近会话是否全更新
 */
+ (BOOL)updateChatWithMessage:(YNMessage *)message changRecentChat:(BOOL)isChange;

//更新未读标识
+ (BOOL)updateUnReadMessageNumberWithIdentify:(NSString *)identify;

//将广播消息标记为已读
+ (BOOL)updateIsReadToReadInDatabaseWithPacketid:(NSString *)packetid;

//更新消息的高度
+ (BOOL)updateMessageHeightWithMessage:(YNMessage*)message;

/**JC** 将isNewListPullData更新为YES，表示已经拉取过消息漫游 **/
+ (BOOL)updateRecentNewListPullDataUnreadCountByOneWithUserNo:(NSString *)userNo;

#pragma mark - Broadcast Mothed

//广播消息保存数据库(一条)
+ (BOOL)saveBroadcastWithMessage:(YNBroadcastChat *)broadcast;

//删除广播消息: if packetId = nil , delete ALL Broadcast.
+ (BOOL)deleteBroadcastMessageWithPacketId:(NSString *)packetId;

//查询20条广播消息
+ (NSArray *)queryBroadcastWithStartIndex:(NSInteger)start
                                 endIndex:(NSInteger)end;

#pragma end

#pragma mark - Broadcast Notification Mothed

//保存广播通知数据(一条)
+ (BOOL)saveBroadcastNotificationWithMessage:(YNBroadcastNotificationChat *)notification;

//删除广播通知数据
+ (BOOL)deleteBroadcastNotificationWithObject:(id)object;

//查询广播通知数据
+ (NSArray *)queryBroadNotificationWithType:(YNBroadcastNotificationType)broadcastNotificationType;

//查询未读广播通知数据
+ (NSArray *)queryUnReadBroadNotificationWithType:(YNBroadcastNotificationType)broadcastNotificationType;

//删除一部分广播通知数据
+ (BOOL)deleteBroadcastNotificationWithMessageObject:(id)object;

//pocketId为空则更新全部未读通知
+ (BOOL)updateUnReadBroadNotificationWithType:(YNBroadcastNotificationType)broadcastNotificationType pocketId:(NSString *)pocketId;
#pragma end



/**
 *  在登录成功以后, 调用此方法
 *  1.更新两人会话, 将会话中发送中的状态转变成发送失败状态
 *  2.更新多人会话, 将会话中发送中的状态转变成发送失败状态
 *  3.更新最近会话, 将会话中发送中的状态转变成发送失败状态
 */
+ (BOOL)updateMessageSendingStateWhenLoggedIn;

/**
 * 根据传来的消息删除对应的会话消息
 */
+ (BOOL)deleteAChatMessageFromMessageData:(YNMessage *)message;

// 图片下载后更新
+ (BOOL)updateMessageImageWithMessage:(YNMessage*)message;

//更新文件消息状态
+ (BOOL)updateMessageFileStateWithMessage:(YNMessage*)message;

/**
 *  更新语音已读状态 2016.8.1jc添加
 *
 *  @param message message对象
 *
 *  @return 返回参数
 */
+(BOOL)updateMessageVoiceStateWithMessage:(YNMessage *)message;


/**
 修改两人会话撤回状态
 
 @param packId ID
 @return
 */
+(BOOL)updateTwoPeopleChatWithdrawWithPackId:(NSString *)packId;

/**
 JC修改群，讨论组，项目组撤回状态
 
 @param packId id
 @param groupType
 @return
 */
+(BOOL)updateManyPeopleMessageWithdrawWithPacketId:(NSString *)packId groupType:(int)groupType;


/**
 修改撤回状态  2018.11.27jc添加
 
 @param chatId 对方id
 @param packId 消息id
 @return
 */
+(BOOL)updateRecentChatWithdrawWithChatId:(NSString *)chatId packId:(NSString *)packId;

/**HX** 获取会话列表本地存的指定userNo的未读数 **/
+ (int)queryUnReadWithUserNo:(NSString *)userNo;
@end
